package model

import (
	"gorm.io/gorm"
)

type Rule struct {
	gorm.Model
	Symbol        string  `gorm:"column:symbol;type:varchar(50);not null" json:"symbol"`
	MinOperator   string  `gorm:"column:min_operator;type:char(2)" json:"minOperator"`
	MinValue      float64 `gorm:"column:min_value;type:decimal(20,8)" json:"minValue"`
	MaxOperator   string  `gorm:"column:max_operator;type:char(2)" json:"maxOperator"`
	MaxValue      float64 `gorm:"column:max_value;type:decimal(20,8)" json:"maxValue"`
	EmailTemplate string  `gorm:"column:email_template;type:text" json:"emailTemplate"`
	Interval      string  `gorm:"column:interval;type:varchar(10)" json:"interval"`
	IsEnabled     bool    `gorm:"column:is_enabled;default:true" json:"isEnabled"`
	TargetEmails  string  `gorm:"column:target_emails;type:text" json:"targetEmails"`
}

func (Rule) TableName() string {
	return "crypto_rules"
}
